import { NoSkinCellRenderer } from "../../common/item/NoSkinCellRenderer";
import { GlobalStyle } from "../../../../common/global/GlobalStyle";
import { ObjCreate } from "../../common/ObjCreate";
import { ImagesConst } from "../../../resource/ImagesConst";
import { ArenaCrossPlayerScheduleData } from "../arenaCrossData/ArenaCrossPlayerScheduleData";
import { Language } from "../../../../../extend/language/Language";
import { PlayerUtil } from "../../common/util/PlayerUtil";
import { DateParser } from "../../../../common/tools/DateParser";
//class GroupMatchPlayerScheduleCellRenderer
    
    export  class GroupMatchPlayerScheduleCellRenderer extends NoSkinCellRenderer
    {
        constructor()
        {
            super();
            return;
        }

        protected /* override */ createChildren(): void
        {
            super.createChildren();
            var loc1=GlobalStyle.textFormat1;
            loc1.align = flash.text.TextFormatAlign.CENTER;
            this._numText = ObjCreate.createTextField("", 0, 6, 30, 20, this, loc1);
            this._nameText = ObjCreate.createTextField("", 30, 6, 100, 20, this, loc1);
            this._bmpVS = ObjCreate.createBitmap(ImagesConst.ArenaVS, 136, -5, this);
            this._ennemyText = ObjCreate.createTextField("", 165, 6, 165, 20, this, loc1);
            this._timeText = ObjCreate.createTextField("", 335, 6, 50, 20, this, loc1);
            return;
        }

        public /* override */ set data(arg1: Object)
        {
            if (typeof arg1 === "arenacrossplayerscheduledata") 
            {
                this._playerScheduleData = arg1 as ArenaCrossPlayerScheduleData;
                this.updateView();
            }
            return;
        }

        /* internal  */updateView(): void
        {
            this._numText.text = this._playerScheduleData.num.toString();
            this._nameText.text = this._playerScheduleData.playerMiniInfo.name.toString();
            if (this._playerScheduleData.enemyEntityId.id == 0) 
            {
                this._ennemyText.text = Language.getString(20400);
            }
            else 
            {
                this._ennemyText.text = PlayerUtil.getProxyAndNameByEntityIdAndName(this._playerScheduleData.enemyEntityId, this._playerScheduleData.enemyName);
            }
            this._timeText.text = DateParser.parse(this._playerScheduleData.battleDt, "hh: mm");
            return;
        }

        /* internal */ /* var */_playerScheduleData: ArenaCrossPlayerScheduleData;

        /* internal */ /* var */_numText: Object /* flash.text.TextField */;

        /* internal */ /* var */_nameText: Object /* flash.text.TextField */;

        /* internal */ /* var */_bmpVS: Object /* flash.display.Bitmap */;

        /* internal */ /* var */_ennemyText: Object /* flash.text.TextField */;

        /* internal */ /* var */_timeText: Object /* flash.text.TextField */;
    }
